This is my monthly report for ``.
Using tabs: https://bookdown.org/yihui/rmarkdown-cookbook/html-tabs.html
https://rstudio.com/resources/rstudioconf-2020/rmarkdown-driven-development/
Packages I’m going to use
#The report
library(rmarkdown)
#Tables
library(DT)
library(reactable)
#Plots
library(ggplot2)
library(plotly)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(fredr)
df1 <- fredr(
series_id = "UNRATE",
observation_start = as.Date("2002-01-01"),
observation_end = as.Date(paste(params$year, params$month, '01', sep = "-"))
) %>% mutate(series_id = " Total")
df2 <- fredr(
series_id = "LNS14000006",
observation_start = as.Date("2002-01-01"),
observation_end = as.Date(paste(params$year, params$month, '01', sep = "-"))
) %>% mutate(series_id = "Black/African American")
df3 <- fredr(
series_id = "LNS14000003",
observation_start = as.Date("2002-01-01"),
observation_end = as.Date(paste(params$year, params$month, '01', sep = "-"))
) %>% mutate(series_id = "White")
df4 <- fredr(
series_id = "LNS14000009",
observation_start = as.Date("2002-01-01"),
observation_end = as.Date(paste(params$year, params$month, '01', sep = "-"))
) %>% mutate(series_id = "Hispanic/Latino")
df <- rbind(df1, df2, df3, df4) %>%
rename(Category = series_id,
Date = date,
UR = value) %>%
select(-realtime_start, -realtime_end) %>%
mutate(recession = ifelse(Date >= '2020-02-01' | (Date >= '2007-12-01' & Date < '2009-07-01') | (Date >= '2001-03-01' & Date < '2001-12-01'), TRUE, FALSE),
quarter_start = ifelse(substr(Date, 6, 7) %in% c('01','04','07','10'), TRUE, FALSE))
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.